<style>
    html, body, h1, form, fieldset, legend, ol ,li{
        padding:0;
        margin:0;
    }
    ol{
        list-style:none;
    }
    form#payment{
        background:darkgray;
        -webkit-border-radius:5px;
        border-radius:5px;
        padding:20px;
        width:400px;
    }
    form#payment fieldset{
        border:none;
        margin-bottom:10px;
    }
    form#payment fieldset:last-of-type{ margin-bottom:0; }
    form#payment legend {
        color:#384313;
        font-size:16px;
        font-weight:bold;
        padding-bottom:10;
        text-shadow:0px 1px 1px #c0d576;
    }
    form#payment fieldset fieldset legend {
        color:#111;
        font-size:13px;
        font-weight:normal;
        padding-bottom:0;
    }
    form#payment ol li {
        background:#b9cf6a;
        background:rgba(255, 255, 255, 0.3);
        border:#e3ebc3;
        border-color:rgba(255, 255, 255, 0.6);
        border-style:solid;
        border-width:2px;
        -webkit-border-radius:5px;
        line-height:30px;
        padding:5px 10px;
        margin-bottom:2px;
    }
    form#payment ol ol li {
        bakcground:none;
        border:none;
        float:left;
    }
    form#payment label {
        float:left;
        font-size:13px;
        width:110px;
    }
    form#payment fieldset fieldset label {
        background:none no-repeat left 50%;
        line-height:20px;
        padding:0 0 0 30px;
        width:auto;
    }
    form#payment fieldset fieldset label:hover{cursor:pointer;}
    form#payment input:not([type=radio]), form#payment textarea{
        background:#fff;
        border:#fc3 solid 1px;
        -webkit-border-radius:3px;
        outline:none;
        padding:5px;
    }
    select{
    	width: 170px;
    	background:#fff;
        border:#fc3 solid 1px;
        -webkit-border-radius:3px;
        outline:none;
        padding:5px;
    }
    </style>
<body>
	<?php
		      	require_once "app/conn.php";
		      	$sql1="select * from book where id='".$_GET['change']."'";
				$result1 = $conn->query($sql1);
				while($row1 = mysqli_fetch_assoc( $result1 )){
				?>
<form id="payment" action="/houtai.php?ctr=add" method="post">
    <fieldset>
        <legend>图书信息</legend>
        <ol>
            <li>
                <label >书名：</label>
                <input type="text" name="书名" placeholder="请输入书名" value="<?php echo $row1['书名']?>" required autofocus>
            </li>
            <!--<li>
                <label>编号：</label>
                <input type="text" name="id" placeholder="123456" required>
            </li>-->
            <li>
                <label>出版社：</label>
                <input type="text" placeholder="中国教育出版社" name="出版社" value="<?php echo $row1['出版社']?>">
            </li>
            <li>
                <label>出版日期：</label>
                <input type="date"  name="出版日期" style="width: 157px;" value="<?php echo $row1['出版日期']?>">
            </li>
            <li>
                <label for="phone">作者：</label>
                <input type="text" name="作者" value="<?php echo $row1['作者']?>">
            </li>
            <li>
                  <label>类型:</label>
		    <select name="类型">
		      <option selected="selected"><?php echo $row1['类型']?></option>
		      <?php
		      	$sql="select * from classes";
				$result = $conn->query($sql);
				while($row = mysqli_fetch_assoc( $result )){
				?>
		      <option><?php echo $row['类别']?></option>
		      <?php }?>
		    </select>
            </li>
            <li>
                <label >数量：</label>
                <input type="hidden" name="act" value="act" />
                <input type="number" placeholder="该类图书剩余数量"  name="数量" value="<?php echo $row1['数量']?>">
            </li>
        </ol>
 		<input type="submit" style="width: 100px; margin-top: 10px;margin-left: 70%" value="修改"/>
</form>
<?php }?>
<!--
	修改数据
-->
<?php 
	
	if(!empty($_POST['act']))
	{
	$sql = "UPDATE book set 书名='".$_POST['书名']."' where id=".$_GET['change']."";
	$conn->query($sql);
	//VALUES ( '".$_POST['书名']."','".$_POST['出版社']."','".$_POST['出版日期']."','".$_POST['作者']."','".$_POST['类型']."',".$_POST['数量'].")";
	$sql = "UPDATE book set 出版社='".$_POST['出版社']."' where id=".$_GET['change']."";
	$conn->query($sql);
	$sql = "UPDATE book set 出版日期='".$_POST['出版日期']."' where id=".$_GET['change']."";
	$conn->query($sql);
	$sql = "UPDATE book set 作者='".$_POST['作者']."' where id=".$_GET['change']."";
	$conn->query($sql);
	$sql = "UPDATE book set 类型='".$_POST['类型']."' where id=".$_GET['change']."";
	$conn->query($sql);
	$sql = "UPDATE book set 数量=".$_POST['数量']." where id=".$_GET['change']."";
	$conn->query($sql);
    
}
	
	?>

</body>